package com.wxy.test2.adapterpattern;

public class OperationAdapter implements DataOperation{
    private BinarySearch binarySearch;
    private QuickSort quickSort;

    public OperationAdapter(BinarySearch binarySearch, QuickSort quickSort) {
        this.binarySearch = binarySearch;
        this.quickSort = quickSort;
    }

    @Override
    public void sort(int[] array) {
        quickSort.quickSort(array);
    }

    @Override
    public int search(int[] array, int key) {
        return binarySearch.binarySearch(array, key);
    }
}
